//
//  UICollectionReusableView+WSExtension.m
//  Component
//
//  Created by 王诗文 on 2018/8/1.
//  Copyright © 2018年 王诗文. All rights reserved.
//

#import "UICollectionReusableView+WSExtension.h"
#import <objc/runtime.h>

@implementation UICollectionReusableView (WSExtension)

//delegate
+ (CGSize)wsCalculateSizeWithContent:(id)content {
    return CGSizeZero;
}

- (void)wsFillContent:(id)content {
}

- (void)setWsDelegate:(id<WSCollectionReusableViewActionDelegate>)wsDelegate{
    objc_setAssociatedObject(self, @selector(wsDelegate), wsDelegate, OBJC_ASSOCIATION_ASSIGN);
}

- (id<WSCollectionReusableViewActionDelegate>)wsDelegate{
    return objc_getAssociatedObject(self, _cmd);
}

- (NSInteger)section{
    return [objc_getAssociatedObject(self, _cmd) integerValue];
}

- (void)setSection:(NSInteger)section{
    objc_setAssociatedObject(self, @selector(section), @(section), OBJC_ASSOCIATION_ASSIGN);
}



- (void)headerClicked:(id)data{
    [self.wsDelegate headerClickedInSection:self.section data:data];
}

- (void)footerClicked:(id)data{
    [self.wsDelegate footerClickedInSection:self.section data:data];
}

@end
